ClientWebGLContext.cpp: the 'empty' method should be used to check for emptiness instead of 'size'
Categories
(Developer Infrastructure :: Source Code Analysis, task)
Tracking
(firefox79 fixed)
Tracking | Status | |
---|---|---|
firefox79 | --- | fixed |
People
(Reporter: Sylvestre, Assigned: nd419, Mentored)
References
(Blocks 1 open bug)
Details
(Keywords: good-first-bug, Whiteboard: [lang=C++])
Attachments
(1 file, 1 obsolete file)
+++ This bug was initially created as a clone of Bug #1626786 +++
Filling as a good first bug to learn workflows.
if (notLost.info.error.size()) {
ThrowEvent_WebGLContextCreationError(notLost.info.error);
return false;
}
should use .empty() instead
https://searchfox.org/mozilla-central/source/dom/canvas/ClientWebGLContext.cpp#759
As the change is trivial, it is just to learn how to contribute to Firefox.
Found by http://clang.llvm.org/extra/clang-tidy/checks/readability-container-size-empty.html
Tutorial to contribute:
https://firefox-source-docs.mozilla.org/tools/docs/contribute/how_to_contribute_firefox.html
Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.
Also, please only work on two max of such bugs.
Updated•5 years ago
|
Updated•5 years ago
|
Reporter | ||
Comment 3•5 years ago
|
||
Well done!
Could you please request the patch to land? It is explained in the documentation
Comment 5•5 years ago
|
||
Isn't this doing the opposite of what it should do?
if (notLost.info.error.size()) {
ThrowEvent_WebGLContextCreationError(notLost.info.error);
return false;
}
is not equivalent to
if (notLost.info.error.empty()) {
ThrowEvent_WebGLContextCreationError(notLost.info.error);
return false;
}
!!notLost.info.error.size() != notLost.info.error.empty()
Comment 6•5 years ago
|
||
Backed out changeset f5eed997b258 (bug 1629419) for crashtests, bc failures and gpu failures
Backout: https://hg.mozilla.org/integration/autoland/rev/9411b6a446eb7438f2fd43c59460ffa42c4ad898
Failure logs:
crashtests: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=307247508&repo=autoland&lineNumber=6762
bc failures: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=307247507&repo=autoland&lineNumber=3308
gpu failures: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=307254994&repo=autoland&lineNumber=1636
Updated•5 years ago
|
(In reply to mac198442 from comment #7)
Should it not have been
if (!notLost.info.error.empty()) {
Yes sorry, I had this on my other revision but accidentally had this one accepted instead of the other.
Comment 9•5 years ago
|
||
Yeah, I missed it -- as I said in my review, I thought the patches were identical but I had missed that this one was missing the '!'. nd419, you can just resubmit the working patch and I'll approve it. You should also choose "Abandon Revision" for the patch that I mistakenly approved. I see you had added a note after my approval saying that the patches weren't identical but I never saw it since I wasn't following the bug. Basically, we had bad luck. In the future, if you want to make sure that a reviewer sees an important comment on something that has been approved, you can always re-request a review with a note explaining the reason.
Updated•5 years ago
|
Updated•5 years ago
|
Comment 10•5 years ago
|
||
Comment 11•5 years ago
|
||
bugherder |
Updated•3 years ago
|
Description
•